package com.jecy.controller;

import com.jecy.domain.User;
import com.jecy.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by huijun on 16/10/21.
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;
    @RequestMapping("/showUser")
    public ModelAndView showUser(HttpServletRequest request,HttpServletResponse response) {

       User user = userService.queryUserById(1);
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("showUser");
        modelAndView.addObject("user",user);
        return modelAndView;
    }

}
